package com.epalmpay.service.member;

import java.util.Date;
import java.util.List;

import com.epalmpay.exception.ApplicationException;
import com.epalmpay.dto.activity.CouponInDTO;
import com.epalmpay.dto.activity.RedPackageInDTO;
import com.epalmpay.dto.member.BalanceInDTO;
import com.epalmpay.dto.member.MemberConsumeOutDTO;
import com.epalmpay.dto.member.MemberInDTO;
import com.epalmpay.dto.member.MemberListOutDTO;
import com.epalmpay.dto.member.MemberOutDTO;
import com.epalmpay.dto.member.MemberTradeDetailInDTO;
import com.epalmpay.dto.member.*;
import com.epalmpay.entity.*;

public interface IMemberService {


	Member findMemberinfo(Member member)throws Exception;
//	List<MemberOutDTO> getMemberList(Long gradeId, String fromName, Integer wxsubStaus, Date joinStart, Date joinEnd,
//			String name, Page page)throws Exception;
//	
	List<MemberOutDTO> getMemberList(MemberInDTO memberInDTO, Page page)throws Exception;
	//查看会员详情
	Member findMemberById(Member member)throws Exception;

	//编辑时回显 根据id查询会员信息
	Member findById(Member member)throws Exception;
	
	//会员详细信息 保存时查会员信息
	Member findMemberDetailById(Member member)throws Exception;
	//查询会员银行卡信息
	List<MemberCard> queryMemberCardList(MemberInDTO memberInDTO)throws Exception;

	void editMember(Member members)throws Exception;
	//编辑时回显 根据id查询会员等级信息
//	Member findMemberGradeById(Member member);
	List<MemberOutDTO> findMemberGradeById(Long id)throws Exception;
	
	MemberListOutDTO queryTradeDetail(MemberTradeDetailInDTO memberTradeDetailInDTO, Page page)throws ApplicationException;
	
	//查询账户余额
	MemberOutDTO queryAmount(MemberInDTO memberInDTO) throws ApplicationException;
	
	
	/**
	 * 微信授权页查询账户余额
	 * @param openid
	 * @param groupId
	 * @return
	 * @throws ApplicationException
	 */
	MemberOutDTO queryAmountOpenId(String openid,String groupId) throws ApplicationException;
	
	//重置支付密码
	Member reSet(MemberInDTO memberInDTO,String rootHomeUrl)throws Exception;
	
	//会员详情中编辑会员等级保存方法中 查询会员等级
	Member findGradeMemberById(Member member)throws Exception;
	//修改会员等级
	void updateMember(Member member)throws Exception;
	
	
	//编辑会员登入密码  
	Member findPasswordById(Member member)throws Exception;
	//修改会员登入密码
	void updateMemberLoginPassword(Member member)throws Exception;
	

	//按条件查询member
	List<Long> getMembers(RedPackageInDTO redPackageInDTO)throws Exception;
	//按条件查询会员
	List<Long> getMembersByCoupon(CouponInDTO couponInDTO)throws Exception;
	
	MemberConsumeOutDTO queryMemberConsumeData(MemberTradeDetailInDTO memberTradeDetailInDTO)throws Exception;


	/**
	 * 
	 * 代理商后台的会员管理
	 */
	List<MemberOutDTO> getAgentMemberList(Long agentId,Long gradeId, String fromName, Integer wxsubStaus, Date joinStart, Date joinEnd,
			String name, Page page)throws Exception;
	
	
	//查看会员详情
	Member findAgentMemberById(Member member)throws Exception;

	//编辑时回显 根据id查询会员信息
	Member findAgentById(Member member)throws Exception;
	
	//会员详细信息 保存时查会员信息
	Member findAgentMemberDetailById(Member member)throws Exception;
	
	
	//编辑会员登入密码  
	Member findAgentPasswordById(Member member)throws Exception;
	//修改会员登入密码
	void updateAgentMemberLoginPassword(Member member)throws Exception;
	
	MemberConsumeOutDTO queryAgentMemberConsumeData(MemberTradeDetailInDTO memberTradeDetailInDTO)throws Exception;
	

	/**
	 * 门店后台的会员管理
	 */
	
	List<MemberOutDTO> getShopMemberList(Long shopId,Long gradeId, String fromName, Integer wxsubStaus, Date joinStart, Date joinEnd,
			String name, Page page) throws Exception;

	Member findShopMemberDetailById(Member member)throws Exception;

   /**
    * 根据openId查看会员详情
    * @param openid
    * @return
    * @throws Exception
    */
	
	public Member findByOpenId(String openid,Long groupId) throws Exception;
	/***
	 * 插入会员交易数据(并判断是否需要自动升级)
	 */
	//public int insertMemberTradeData(Long memberId,Integer amount) throws Exception;
	/***
	 * 插入会员交易数据异步(并判断是否需要自动升级)
	 */
	public int insertMemberTradeDataAsyn(final Long memberId,final Integer amount) throws Exception;

	/***
	 * 插入会员交易数据带积分(并判断是否需要自动升级)
	 * amount交易金额,bonusValue积分使用核销时对应的金额
	 */
	public int insertMemberTradeData(Long memberId,Integer amount,Integer bonusValue) throws Exception;
	/***
	 * 插入会员交易数据带积分异步(并判断是否需要自动升级)
	 */
	public int insertMemberTradeDataAsyn(final Long memberId,final Integer amount,final Integer bonusValue) throws Exception;


	MemberListOutDTO queryAgentTradeDetail(MemberTradeDetailInDTO memberTradeDetailInDTO, Page page) throws Exception;
	
	MemberListOutDTO queryShopTradeDetail(MemberTradeDetailInDTO memberTradeDetailInDTO, Page page) throws Exception;
	
	MemberConsumeOutDTO queryShopMemberConsumeData(MemberTradeDetailInDTO memberTradeDetailInDTO) throws Exception;
	
	//YsOilcardMember queryOilcardMember(YsOilcardMember ysOilcardMember)throws Exception;
	public List<YsOilcardMember> queryOilcardMember(MemberInDTO memberInDTO) throws Exception;

	YsObd queryOdbDetail(YsObd ysObd)throws Exception;
	/**
	 * 会员总交易数
	 * @param thirdUserID
	 * @param paymentAmount
	 * @return
	 */
	int insertMemberTradeDataAsyn(String thirdUserID, Integer paymentAmount)throws Exception;

	//会员增加余额
    MemberOutDTO addBalance(BalanceInDTO balanceInDTO,String rootHomeUrl) throws ApplicationException;

	MemberListOutDTO queryMemberBonusList(MemberBonusLogInDTO memberBonusLogInDTO, Page page)throws Exception;
	
	Member selectByOpenId(String openId)throws Exception;

	//开通钱包时送积分或优惠券
	public int sendBonusOrRedOrCoupon(Long memberId,Long gradeId,Long groupId);


	public int updateMemberFirstTradeSend(Long id,Long memberId,Long groupId,Integer Amount) throws Exception;



	/**
	 * 根据会员电话，查找会员基本信息
	 * @param memberIn 会员
	 * @return
	 */
	public Member selectMemberByPhone(Member memberIn);


	public int updateStatisMemberInfo(Long memberId,Integer realAmount);


	public Boolean updatequeryMemberBanal (String virtualCard,String payGroupCode,Long userId,Integer tranAmt) throws ApplicationException;

	/**
	 * 添加用户
	 * @param groupId
	 * @param openid
	 * @return
	 */
	public Long addMemberInfo(String groupId, String openid, String memberid);
}
